﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Frame.Lib.Common
{
    public sealed class AppSession
    {
        public static System.Web.SessionState.HttpSessionState Session
        {
            get
            {
                if (System.Web.HttpContext.Current == null)
                {
                    return null;
                }
                else
                {
                    return System.Web.HttpContext.Current.Session;
                }
            }
        }

        public static int UserID
        {
            get
            {
                return (int)Session["UserID"];
            }
            set
            {
                Session["UserID"] = value;
            }
        }

        public static string UserName
        {
            get
            {
                if (Session == null)
                {
                    return null;
                }
                else
                {
                    return (string)Session["UserName"];
                }
            }
            set
            {
                Session["UserName"] = value;
            }
        }
        public static string LoginName
        {
            get
            {
                if (Session == null)
                {
                    return null;
                }
                else
                {
                    return (string)Session["LoginName"];
                }
            }
            set
            {
                Session["LoginName"] = value;
            }
        }
        public static List<int> DeptID
        {
            get
            {
                return (List<int>)Session["DeptID"];
            }
            set
            {
                Session["DeptID"] = value;
            }
        }
        public static string DeptName
        {
            get
            {
                return (string)Session["DeptName"];
            }
            set
            {
                Session["DeptName"] = value;
            }
        }

        public static int CompanyID
        {
            get
            {
                return (int)Session["CompanyID"];
            }
            set
            {
                Session["CompanyID"] = value;
            }
        }

        public static string CompanyLoginName
        {
            get
            {
                if (Session == null)
                {
                    return null;
                }
                else
                {
                    return (string)Session["CompanyLoginName"];
                }
            }
            set
            {
                Session["CompanyLoginName"] = value;
            }
        }

        public static void Clear()
        {
            Session.Clear();
        }

    }
}
